<?php

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

$api = app('Dingo\Api\Routing\Router');

$api->version('v1', function ($api) {
    $api->group(['namespace' => 'App\Http\Controllers\Api\V1'], function ($api){
        $api->get('banner/{id}', 'BannerController@getBanner')->where('id', '\d+');
        $api->get('theme/', 'ThemeController@getSimpleList');
        $api->get('theme/{id}', 'ThemeController@getComplexOne')->where('id', '\d+');
        $api->get('product/recent', 'ProductController@recent');
        $api->get('product/{id}', 'ProductController@getOne')->where('id', '\d+');
        $api->get('product/by_category', 'ProductController@getAllInCategory');
        $api->get('category/all', 'CategoryController@getAllCategories');
        $api->post('address', 'AddressController@createOrUpdateAddress');
        $api->post('token/user', 'TokenController@getToken');
        $api->post('order', 'OrderController@placeOrder');
        $api->post('pay/pre_order', 'WxPayController@getPreOrder');
        $api->post('pay/notify', 'WxPayController@receiveNotify');
    });
});